package errors;

import strings.Str;

import java.util.Vector;

/**
 * User: MiF
 * Date: 29.12.11
 * Time: 15:52
 */
public class MyWarning {
    private static Vector<MyWarningInfo> warnings = new Vector<MyWarningInfo>();

    public static void add(String text, String msg) {
        warnings.add(new MyWarningInfo(-1, text, msg));
    }

    public static void add(Str str, String msg) {
        warnings.add(new MyWarningInfo(str.getLine(), str.getCommand(), msg));
    }

    public static void print() {
        for (MyWarningInfo warning : warnings)
            System.out.println("[WARNING] " + warning.getMsg() + " [" + warning.getText() + ((warning.getLine() >= 0) ? ":" + warning.getLine() : "") + "]");
    }
}
